-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
machine_core: Add Machine nspawn clone API #6974
Conversation
So there are several problems with this -- RHEL does not have networkd, and many/most OSes don't have a snapshot-capable file system, e.g. debian-stable. There,
On debian-stable I've had some success with creating overlay delta directories and doing
However, |
There are tests which require two independent machines in terms of networking, services, packages, and file systems -- this can cover e.g. the shell's host switching, or cockpit-machine's VM migration or remote terminal functionality. Previously we used destructive tests with `provision`ing multiple VMs; but this is expensive and prevents us from running these tests in tmt. But for the above tests which don't require kernel modules/functionality, we would be quite happy with the auxiliary machines being a container. Use systemd-nspawn to boot its own parent OS/file system with transient overlays. Unfortunately we can't use the convenient `--ephemeral`: that makes a snapshot of the entire fs, which only works efficiently on btrfs. But we can use `--volatile` and set up a bunch of overlays ourselves. Wrap that functionality into a convenient `Machine.clone_container()` API which returns a new Machine (NspawnMachine subclass) with the usual methods. Teach `SSHConnection` about a jump host (using `ProxyCommand`) to directly connect from the outside test to the inner nspawn container. This first version only supports one cloned container at a time. Supporting multiple would be nice, but requires some reengineering of the SSHConnection master.
e7ca659
to
93a3fd9
Compare
Next step -- more legwork with manual overlays, which should work fine on ext4 now. I triggered another round of testing. Remaining big issue is that neither RHEL nor CoreOS have systemd-networkd, which makes configuring the inner and outer veth awkward. Need to find a way to do this with NM or other tools. |
parent.execute(f"until timeout 1 nc -z {address} 22; do sleep 1; done") | ||
|
||
super().__init__( | ||
address, parent.image, verbose, parent.label + "-" + label, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like self.verbose
and maybe others should be initialized earlier, in case the code above throws an error.
FTR: I played around with |
Some more ideas:
|
This would have been really neat, but not being able to run this on RHEL sensibly is a dealbreaker. So I'm admitting defeat here. |
There are tests which require two independent machines in terms of networking, services, packages, and file systems -- this can cover e.g. the shell's host switching, or cockpit-machine's VM migration or remote terminal functionality.
Previously we used destructive tests with
provision
ing multiple VMs; but this is expensive and prevents us from running these tests in tmt. But for the above tests which don't require kernel modules/functionality, we would be quite happy with the auxiliary machines being a container.systemd-nspawn supports booting its own parent OS/file system with a transient overlay. Wrap that functionality into a convenient
Machine.clone_container()
API which returns a new Machine (NspawnMachine subclass) with the usual methods. TeachSSHConnection
about a jump host (usingProxyCommand
) to directly connect from the outside test to the inner nspawn container.This first version only supports one cloned container at a time. Supporting multiple would be nice, but requires some reengineering of the SSHConnection master.
I tested this locally, and also sent a Cockpit PR to exercise this: cockpit-project/cockpit#21105